﻿//********************************************************************************//
//创建日期：<创建日期，2016-04-11>
//创建作者：<郭登杰，guodengjie@shanghai3h.com>
//功能说明：打印通知单
//********************************************************************************//
layui.use(['form', 'jquery', 'element', 'laydate'], function () {
    var form = layui.form()
    , layer = layui.layer
    , $ = layui.jquery
    , element = layui.element()
    , laydate = layui.laydate;
    /*initial load start*/
    initcontrol();
    /*initial load end*/

    /*initial*/
    function initcontrol() {
        //设置默认打印日期与回执日期
        var date = new Date()
        $("#printdate").val(date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate());
        //$("#c2PrintDate").val(date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate());
        $("#c3PrintDate").val(date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate());
        //获取当前水量年月
        $.ajax({
            type: "post",
            cache: false,
            async: false,
            url: "/ashx/Common.ashx",
            data: {
                "op": "QSYM"
            },
            dataType: "json",
            success: function (rs) {
                $("#cYM").val(rs.Data1);
                $("#c2YM").val(rs.Data1);
            },
            error: function (error) {
                layer.msg(error.responseText);
            }
        });
        //显示当前发票号码
        $("#lsBillNo").text(getFaPiaoHM(1));

    }
    /*end initial*/

    /*event*/
    $("#oSearch").click(function () {
        if ($("#cYM").val() == "") {
            layer.alert("请输入水量年月");
            return;
        }
        var checkboxs = $("[name='cPrinted']:checked");
        if (checkboxs.length == 0) {
            layer.alert("至少选择一种打印状态");
            return;
        }
        var ym = $("#cYM").val();
        //2种选中情况  1:已打印未打印均选中 查询全部用2表示  2:查询1种(1:已打印 0:未打印)
        var printed = (checkboxs.length == 2) ? 2 : (checkboxs.length == 1) ? $(checkboxs[0]).val() : -1;
        var printdate = $("#printdate").val();
        load(ym, printed, printdate);
    });

    $("#o2Search").click(function () {
        var checkboxs = $("[name='c2Printed']:checked");
        if (checkboxs.length == 0) {
            layer.alert("至少选择一种打印状态");
            return;
        }
        var ym = $("#c2YM").val();
        //2种选中情况  1:已打印未打印均选中 查询全部用2表示  2:查询1种(1:已打印 0:未打印)
        var zt = (checkboxs.length == 2) ? 0 : (checkboxs.length == 1) ? $(checkboxs[0]).val() : -1;
        var hm = $("#c2HM").val();
        var printdate = $("#c2PrintDate").val();
        load2(zt, ym, hm, printdate);
    });
    $("#o2Clear").click(function () {
        chunk($("#ContentList2 .datarow"), list2Clear, null);
    });

    $("#o3Search").click(function () {
        var printdate = $("#c3PrintDate").val();
        load3(printdate);
    });
    $("#o3Clear").click(function () {
        $("#ContentList3 .datarow").remove();
        $("#ls3Count").text(0);
    });

    $("#o2Operate").click(function () {
        var checks = $("#ContentList2 .datarow").find("[name='liCheck']:checked");
        if (checks.length == 0) {
            layer.alert("请勾选要操作的项");
            return;
        }
        //获取选中发票号码
        var bhsArr = new Array();
        $(checks).each(function () {
            bhsArr.push($(this).attr("vid"));
        });
        var zdbhsArr = new Array();
        $(checks).each(function () {
            zdbhsArr.push($(this).attr("vid2"));
        });
        layer.alert("将选中发票打印状态变更为:", {
            btn: ['成功', '打坏', '未打印'],
            btn1: function (index) {
                //同一账单不能有两条以上成功打印记录
                for (var i = 0; i < zdbhsArr.length; i++) {
                    for (var j = 0; j < zdbhsArr.length; j++) {
                        if (i != j && zdbhsArr[i] == zdbhsArr[j]) {
                            layer.alert("同一账单不能有两条以上成功打印记录");
                            layer.close(index);
                            return;
                        }
                    }
                }
                $.ajax({
                    type: "post",
                    cache: false,
                    async: false,
                    url: "/ashx/QSSFZW/ZhangDan.ashx",
                    data: {
                        "op": "DYZTBG_DBS",
                        "dyzt": 1,
                        "fphms": bhsArr.join(",")
                    },
                    dataType: "json",
                    success: function (rs) {
                        if (rs.State) {
                            //更新打印状态显示
                            //未变更的排除
                            var bhsT = rs.Data1.split(",");
                            var exists = false;
                            for (var i = 0; i < bhsArr.length; i++) {
                                for (var j = 0; j < bhsT.length; j++) {
                                    if (bhsArr[i] == bhsT[j]) {
                                        exists = true;
                                        break;
                                    }
                                }
                                if (!exists) {
                                    var tr = $("#ContentList2 .datarow[vid='" + bhsArr[i] + "']");
                                    $(tr).find("td").eq(2).text("成功");
                                }
                            }
                            $("#lsBillNo").text(getFaPiaoHM(1));
                        }
                        layer.alert(rs.Msg);
                    },
                    error: function (error) {
                        layer.msg(error.responseText);
                    }
                });
                layer.close(index);
            },
            btn2: function (index) {
                $.ajax({
                    type: "post",
                    cache: false,
                    async: false,
                    url: "/ashx/QSSFZW/ZhangDan.ashx",
                    data: {
                        "op": "DYZTBG_DBS",
                        "dyzt": 2,
                        "fphms": bhsArr.join(",")
                    },
                    dataType: "json",
                    success: function (rs) {
                        if (rs.State) {
                            //更新打印状态显示
                            for (var i = 0; i < bhsArr.length; i++) {
                                var tr = $("#ContentList2 .datarow[vid='" + bhsArr[i] + "']");
                                $(tr).find("td").eq(2).text("打坏");
                            }
                            $("#lsBillNo").text(getFaPiaoHM(1));
                        }
                        else {
                            layer.alert(rs.Msg);
                        }
                    },
                    error: function (error) {
                        layer.msg(error.responseText);
                    }
                });
                layer.close(index);
            },
            btn3: function (index) {
                $.ajax({
                    type: "post",
                    cache: false,
                    async: false,
                    url: "/ashx/QSSFZW/ZhangDan.ashx",
                    data: {
                        "op": "DYZTBG_DBS",
                        "dyzt": 0,
                        "fphms": bhsArr.join(",")
                    },
                    dataType: "json",
                    success: function (rs) {
                        if (rs.State) {
                            //更新打印状态显示
                            for (var i = 0; i < bhsArr.length; i++) {
                                var tr = $("#ContentList2 .datarow[vid='" + bhsArr[i] + "']");
                                $(tr).remove();
                            }
                            $("#lsBillNo").text(getFaPiaoHM(1));
                        }
                        else {
                            layer.alert(rs.Msg);
                        }
                    },
                    error: function (error) {
                        layer.msg(error.responseText);
                    }
                });
                layer.close(index);
            }
        });

    });


    //结果列表相关事件
    function bindListOperate() {
        //行点击切换选中状态
        $("#ContentList1 .datarow").each(function () {
            var cb = $(this).find("[name='liCheck']");
            $(this).find("td").unbind("click").click(function () {
                if ($(cb).prop("checked")) {
                    $(cb).removeProp("checked");
                }
                else {
                    $(cb).prop("checked", "checked");
                }
                countSelected();
                form.render("checkbox");
            });
            //移除选择列与发票号码列click事件
            $("#ContentList1 .datarow").each(function () {
                $(this).find("td").eq(0).unbind("click");
                $(this).find("td").eq(7).unbind("click");
            });

        });
    }
    //结果列表相关事件
    function bindListOperat2() {
        //行点击切换选中状态
        $("#ContentList2 .datarow").each(function () {
            var cb = $(this).find("[name='liCheck']");
            $(this).find("td").unbind("click").click(function () {
                if ($(cb).prop("checked")) {
                    $(cb).removeProp("checked");
                }
                else {
                    $(cb).prop("checked", "checked");
                }
                form.render("checkbox");
            });
            //移除选择列click事件
            $("#ContentList2 .datarow").each(function () {
                $(this).find("td").eq(0).unbind("click");
            });

        });
    }
    //监听打印,未打印(对当前列表数据进行筛选显示)
    form.on("checkbox(cPrinted)", function (data) {
        if ($("#cPrinted1").prop("checked")) {
            $("#ContentList1 .datarow[vid2='1']").show();
        }
        else {
            $("#ContentList1 .datarow[vid2='1']").hide();
        }
        if ($("#cPrinted0").prop("checked")) {
            $("#ContentList1 .datarow[vid2='0']").show();
        }
        else {
            $("#ContentList1 .datarow[vid2='0']").hide();
        }
        countSelected();
        countPrintInfo();
    });
    //临听全选/取消
    form.on("checkbox(selectAll)", function (data) {
        if (data.elem.checked) {
            $("#ContentList1 .datarow:visible").find("[name='liCheck']").prop("checked", "checked");
        }
        else {
            $("#ContentList1 .datarow:visible").find("[name='liCheck']").removeProp("checked");
        }
        form.render("checkbox");
        countSelected();
    });
    //临听全选/取消
    form.on("checkbox(selectAll2)", function (data) {
        if (data.elem.checked) {
            $("#ContentList2 .datarow:visible").find("[name='liCheck']").prop("checked", "checked");
        }
        else {
            $("#ContentList2 .datarow:visible").find("[name='liCheck']").removeProp("checked");
        }
        form.render("checkbox");
    });
    //临听选择
    form.on("checkbox(liCheck)", function (data) {
        //form.render("checkbox");
        countSelected();
    });

    //临听发票号码手动输入开关
    form.on("switch(oBillInputSwitch)", function (data) {
        $("#ContentList1 .datarow:visible").each(function () {
            if (data.elem.checked) {
                $(this).find("[name='liFaPiaoHM']").show();
            }
            else {
                $(this).find("[name='liFaPiaoHM']").hide();
            }
        });
    });

    //预览oView
    $("#oView").click(function () {
        var checks = $("#ContentList1 .datarow:visible").find("[name='liCheck']:checked");
        if (checks.length == 0) {
            layer.alert("请选择记录");
            return;
        }
        if ($("#lsBillNo").text() == "") {
            layer.alert("未找到可用的发票号码");
            return;
        }
        //如果开启了发票号码手动输入
        var fphmsArr = new Array();
        //未开启手动输入,获取需要打印账单数量对应的发票号码
        var fphms = getFaPiaoHM($(checks).length);
        fphmsArr = fphms.split(",");
        //账单编号s
        var bhsArr = new Array();
        $(checks).each(function () {
            bhsArr.push($(this).attr("vid"));
        });
        //取得报表参数 
        var bbid = 100208;
        bbtitle = "地下水一般缴款书打印";
        var printdate = $("#printdate").val();
        var returndate = addDate(printdate, 30);
        var params = new Array();
        params[0] = "V_ZHANGDANBHS:" + bhsArr.join(",");
        params[1] = "V_FAPIAOHMS:" + fphmsArr.join(",");
        params[2] = "V_PRINTDATE:" + printdate;
        params[3] = "V_RETURNDATE:" + returndate;
        wap.common.printjx('ZhangDanDY', [
            { key: 'QUERYPARAM', value: params.join("|") },
            { key: 'BAOBIAOID', value: bbid },
            { key: 'USERINFO', value: "csms" }
        ]);
    });
    //打印
    $("#oPrint").click(function () {
        var checks = $("#ContentList1 .datarow:visible").find("[name='liCheck']:checked");
        if (checks.length == 0) {
            layer.alert("请选择要打印的记录");
            return;
        }
        if ($("#lsBillNo").text() == "") {
            layer.alert("未找到可用的发票号码");
            return;
        }
        var logicOK = true;
        $(checks).each(function () {
            if ($(this).attr("vid2") == "1") {
                layer.alert("选中记录中有已经打印过的");
                logicOK = false;
                return false;
            }
        });
        if (!logicOK) return;
        //如果开启了发票号码手动输入
        var fphmsArr = new Array();
        var t = "";
        if ($("#oBillInputSwitch").prop("checked")) {
            $(checks).each(function () {
                t = $("#ContentList1 .datarow[vid='" + $(this).attr("vid") + "']").find("[name='liFaPiaoHM']").val();
                if (t == "") {
                    layer.alert("您选择了手动输入发票号码,请将勾选项的发票号码填写完整.");
                    logicOK = false;
                    return false;
                }
                else {
                    fphmsArr.push(t);
                }
            });
            if (!logicOK) return;
        }
        else {
            //未开启手动输入,获取需要打印账单数量对应的发票号码
            var fphms = getFaPiaoHM($(checks).length);
            fphmsArr = fphms.split(",");
        }
        //账单编号s
        var bhsArr = new Array();
        $(checks).each(function () {
            bhsArr.push($(this).attr("vid"));
        });
        //取得报表参数 
        var bbid = 100208;
        bbtitle = "地下水一般缴款书打印";
        var printdate = $("#printdate").val();
        var returndate = addDate(printdate, 30);
        var params = new Array();
        params[0] = "V_ZHANGDANBHS:" + bhsArr.join(",");
        params[1] = "V_FAPIAOHMS:" + fphmsArr.join(",");
        params[2] = "V_PRINTDATE:" + printdate;
        params[3] = "V_RETURNDATE:" + returndate;
        // var url = "/Pages/YongShui/15.BaoBiaoGL/BaoBiaoView.aspx?x=-3.4&y=-2&baobiaoid=" + bbid + "&baobiaocs=" + params.join("|");
        //TODO: 郭登杰要修改用户信息，用于偏移量判断
        wap.common.printjx('ZhangDanDY', [
            { key: 'QUERYPARAM', value: params.join("|") },
            { key: 'BAOBIAOID', value: bbid },
            { key: 'USERINFO', value: "csms" }
        ]);


        layer.alert("请确认打印状态!", {
            closeBtn: false,
            btn: ['成功', '打坏', '未打印'],
            btn1: function (index) {
                for (var i = 0; i < bhsArr.length; i++) {
                    $.ajax({
                        type: "post",
                        cache: false,
                        async: false,
                        url: "/ashx/QSSFZW/ZhangDan.ashx",
                        data: {
                            "op": "DY_DBS",
                            "dyzt": 1,
                            "zdbh": bhsArr[i],
                            "fphm": fphmsArr[i],
                            "printdate": printdate,
                            "returndate": $("#ContentList1 .datarow[vid='" + bhsArr[i] + "']").find("td").eq(9).text()
                        },
                        dataType: "json",
                        success: function (rs) {
                            if (rs.State) {
                                //更新行打印状态记录值及发票号码
                                var tr = $("#ContentList1 .datarow[vid='" + bhsArr[i] + "']");
                                $(tr).attr("vid2", "1");
                                $(tr).find("[name='liCheck']").attr("vid2", "1");
                                $(tr).find("td").eq(7).text(fphmsArr[i]);
                                $(tr).find("td").eq(8).text(rs.Data1);
                                //更新打印显示                                        
                                countPrintInfo();
                                //重新加载下一张发票号码
                                $("#lsBillNo").text(getFaPiaoHM(1));
                            }
                            else {
                                layer.alert(rs.Msg);
                            }
                        },
                        error: function (error) {
                            layer.msg(error.responseText);
                        }
                    });
                }
                layer.close(index);
            },
            btn2: function (index) {
                for (var i = 0; i < bhsArr.length; i++) {
                    $.ajax({
                        type: "post",
                        cache: false,
                        async: false,
                        url: "/ashx/QSSFZW/ZhangDan.ashx",
                        data: {
                            "op": "DY_DBS",
                            "dyzt": 2,
                            "zdbh": bhsArr[i],
                            "fphm": fphmsArr[i],
                            "printdate": printdate,
                            "returndate": $("#ContentList1 .datarow[vid='" + bhsArr[i] + "']").find("td").eq(9).text()
                        },
                        dataType: "json",
                        success: function (rs) {
                            if (rs.State) {
                                //重新加载下一张发票号码
                                $("#lsBillNo").text(getFaPiaoHM(1));
                            }
                            else {
                                layer.alert(rs.Msg);
                            }
                        },
                        error: function (error) {
                            layer.msg(error.responseText);
                        }
                    });
                }
                layer.close(index);
            },
            btn3: function (index) {

            }
        });

    });

    /*event end*/

    /*list*/
    function createItemStr(obj) {
        var str = $("#ItemStr1 tr").prop("outerHTML");
        var itemstr, zdbh, yhh, yhm, jine, sj, sl, txm, xjrq, dw, dyzt, fphm;
        zdbh = obj["S_ZHANGDANBH"];
        yhh = obj["S_YONGHUH"];
        yhm = obj["S_YONGHUM"];
        jine = obj["N_JINE"];
        sj = obj["N_SHUIJIA"];
        sl = obj["I_YSL"];
        txm = obj["S_TIAOXINGM"];
        xjrq = obj["S_XIANJIAORQ"];
        dw = obj["S_DANWEI"];
        dyzt = obj["I_ZHUANGTAI"];
        fphm = obj["S_FAPIAOHM"]
        itemstr = str.replace(new RegExp("objZhangDanBH", "gm"), zdbh)
                        .replace(new RegExp("objYongHuH", "gm"), yhh)
                        .replace(new RegExp("objYongHuM", "gm"), yhm)
                        .replace(new RegExp("objJinE", "gm"), jine.toFixed(2))
                        .replace(new RegExp("objShuiJia", "gm"), sj.toFixed(2))
                        .replace(new RegExp("objShuiLiang", "gm"), sl)
                        .replace(new RegExp("objTiaoXingM", "gm"), txm)
                        .replace(new RegExp("objXianJiaoRQ", "gm"), xjrq)
                        .replace(new RegExp("objDanWei", "gm"), dw)
                        .replace(new RegExp("objDaYinZT", "gm"), dyzt)
        ;
        fphm = (dyzt == "1") ? fphm : "";
        itemstr = itemstr.replace(new RegExp("objFaPiaoHM", "gm"), fphm);
        return itemstr;
    }

    function load(ym, printed, printdate) {
        var index = layer.load(1);
        $.ajax({
            type: "post",
            cache: false,
            async: false,
            url: "/ashx/QSSFZW/ZhangDan.ashx",
            data: {
                "op": "ZDXX_DBS_HQ",
                "ym": ym,
                "printed": printed,
                "printdate": printdate
            },
            dataType: "json",
            success: function (rs) {
                var strs = "";
                for (var i in rs) {
                    strs = strs + createItemStr(rs[i]);
                }
                $("#lsCount").text(rs.length);
                $("#ContentList1").find(".datarow").remove();
                $("#ContentList1").append(strs);
                //移除已打印行中隐藏的发票号码输入框
                $("#ContentList1").find(".datarow").each(function () {
                    if ($(this).attr("vid2") == "1") {
                        $(this).find("[name='liFaPiaoHM']").remove();
                    }
                });
                form.render("checkbox");
                bindListOperate();
                countSelected();
                countPrintInfo();
            },
            error: function (error) {
                layer.msg(error.responseText);
            }
        });
        layer.close(index);
    }

    function createItemStr2(obj) {
        var str = $("#ItemStr2 tr").prop("outerHTML");
        var itemstr, zdbh, yhh, yhm, jine, sj, sl, ym, dyrq, dyzt, fphm;
        zdbh = obj["S_ZHANGDANBH"];
        yhh = obj["S_YONGHUH"];
        yhm = obj["S_YONGHUM"];
        jine = obj["N_JINE"];
        sj = obj["N_SHUIJIA"];
        sl = obj["I_YSL"];
        ym = obj["I_YM"];
        dyrq = obj["D_DAYINRQ"]["DateString"];
        dyzt = obj["I_ZHUANGTAI"] == "1" ? "成功" : obj["I_ZHUANGTAI"] == "2" ? "打坏" : "未知";
        fphm = obj["S_FAPIAOHM"]
        itemstr = str.replace(new RegExp("objZhangDanBH", "gm"), zdbh)
                        .replace(new RegExp("objYongHuH", "gm"), yhh)
                        .replace(new RegExp("objYongHuM", "gm"), yhm)
                        .replace(new RegExp("objJinE", "gm"), jine.toFixed(2))
                        .replace(new RegExp("objShuiJia", "gm"), sj.toFixed(2))
                        .replace(new RegExp("objShuiLiang", "gm"), sl)
                        .replace(new RegExp("objYM", "gm"), ym)
                        .replace(new RegExp("objDaYinRQ", "gm"), dyrq)
                        .replace(new RegExp("objDaYinZT", "gm"), dyzt)
                        .replace(new RegExp("objFaPiaoHM", "gm"), fphm)
        ;
        return itemstr;
    }
    function load2(zt, ym, hm, printdate) {
        var rss = "";
        $.ajax({
            type: "post",
            cache: false,
            async: false,
            url: "/ashx/QSSFZW/ZhangDan.ashx",
            data: {
                "op": "ZDXX_DBS_HQ2",
                "zt": zt,
                "ym": ym == "" ? 0 : ym,
                "hm": hm,
                "printdate": printdate
            },
            dataType: "json",
            success: function (rs) {
                rss = rs;
            },
            error: function (error) {
                layer.msg(error.responseText);
            }
        });
        var strs = "";
        $("#ls2Count").text(rss.length);
        $("#ContentList2").find(".datarow").remove();
        if (rss.length > 0) {
            chunk(rss, list2Create, bindListOperat2);
        }
    }

    ////循环处理数组,避免假死
    //function chunk(array, process, cbfun) {
    //    var index = layer.load(1);
    //    var i = 0, len = array.length;    //这里要注意在执行过程中数组最好是不变的
    //    setTimeout(function () {
    //        process(array[i], i++);    //循环体要做的操作
    //        if (i < len) {
    //            setTimeout(arguments.callee, 50);
    //        }
    //        else {//循环结束之后要做的操作
    //            if (cbfun!= null) {
    //                cbfun();
    //            }
    //            layer.close(index);           
    //        }
    //    })
    //}
    function list2Create(rs, i) {
        $("#ContentList2").append(createItemStr2(rs));
        $("#ls2Count").text($("#ContentList2 .datarow").length);
    }

    function list2Clear(rs, i) {
        $(rs).remove();
        $("#ls2Count").text($("#ContentList2 .datarow").length);
    }


    function createItemStr3(obj) {
        var str = $("#ItemStr3 tr").prop("outerHTML");
        var itemstr, qshm, jshm, sl, dyrq;
        qshm = obj["S_QISHIFPHM"];
        jshm = obj["S_JIESHUFPHM"];
        sl = obj["I_SL"];
        dyrq = obj["D_DAYINRQ"]["DateString"];
        itemstr = str.replace(new RegExp("objQISHIFPHM", "gm"), qshm)
                        .replace(new RegExp("objJIESHUFPHM", "gm"), jshm)
                        .replace(new RegExp("objSL", "gm"), sl)
                        .replace(new RegExp("objDaYinRQ", "gm"), dyrq)
        ;
        return itemstr;
    }
    function load3(printdate) {
        var index = layer.load(1);
        $.ajax({
            type: "post",
            cache: false,
            async: false,
            url: "/ashx/QSSFZW/ZhangDan.ashx",
            data: {
                "op": "DYTJ_DBS",
                "printdate": printdate
            },
            dataType: "json",
            success: function (rs) {
                var strs = "";
                for (var i in rs) {
                    strs = strs + createItemStr3(rs[i]);
                }
                $("#ls3Count").text(rs.length);
                $("#ContentList3").find(".datarow").remove();
                $("#ContentList3").append(strs);
            },
            error: function (error) {
                layer.msg(error.responseText);
            }
        });
        layer.close(index);
    }

    /*end list*/

    /*logic*/
    function addDate(dateTemp, days) {
        var dateTemp = dateTemp.split("-");
        var nDate = new Date(dateTemp[1] + '-' + dateTemp[2] + '-' + dateTemp[0]); //转换为MM-DD-YYYY格式    
        var millSeconds = Math.abs(nDate) + (days * 24 * 60 * 60 * 1000);
        var rDate = new Date(millSeconds);
        var year = rDate.getFullYear();
        var month = rDate.getMonth() + 1;
        if (month < 10) month = "0" + month;
        var date = rDate.getDate();
        if (date < 10) date = "0" + date;
        return (year + "-" + month + "-" + date);
    }
    //计算选中条数
    function countSelected() {

        $("#lsSelectedCount").text($("#ContentList1 .datarow:visible").find("[name='liCheck']:checked").length);
    }
    //统计当前列表打印与未打印数量及变更颜色
    function countPrintInfo() {
        var printed = $("#ContentList1").find(".datarow[vid2='1']:visible").length;
        var notprinted = $("#ContentList1").find(".datarow[vid2='0']:visible").length;
        $("#lsHasPrinted").text(printed);
        $("#lsHasntPrinted").text(notprinted);
        $("#ContentList1 .datarow").each(function () {
            if ($(this).attr("vid2") == "1") {
                $(this).css("background-color", "yellowgreen");
            }
            else {
                $(this).css("background-color", "");
            }
        });
    }

    function verify() {
        return true;
    }

    /*logic end*/
});